package com.ruoyi.develop.factory.factoryGongxu.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.factory.factoryGongxu.mapper.FactoryGongxuMapper;
import com.ruoyi.develop.factory.factoryGongxu.domain.FactoryGongxu;
import com.ruoyi.develop.factory.factoryGongxu.service.IFactoryGongxuService;

/**
 * 检验工序Service业务层处理
 * @author qh
 * @date 2024-11-06
 */
@Service
public class FactoryGongxuServiceImpl implements IFactoryGongxuService {
    @Resource
    private FactoryGongxuMapper factoryGongxuMapper;

    /**
     * 查询检验工序
     * @param id 检验工序主键
     * @return 检验工序
     */
    @Override
    public FactoryGongxu selectById(String id) {
        return factoryGongxuMapper.selectById(id);
    }

    /**
     * 查询检验工序列表
     * @param entity 检验工序
     * @return 检验工序
     */
    @Override
    public List<FactoryGongxu> selectList(FactoryGongxu entity) {
        return factoryGongxuMapper.selectList(entity);
    }

    /**
     * 新增检验工序
     * @param entity 检验工序
     * @return 结果
     */
    @Override
    public int insert(FactoryGongxu entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return factoryGongxuMapper.insert(entity);
    }

    /**
     * 修改检验工序
     * @param entity 检验工序
     * @return 结果
     */
    @Override
    public int update(FactoryGongxu entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return factoryGongxuMapper.update(entity);
    }

    /**
     * 批量删除检验工序
     * @param ids 需要删除的检验工序主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return factoryGongxuMapper.deleteByIds(ids);
    }

    /**
     * 删除检验工序信息
     * @param id 检验工序主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return factoryGongxuMapper.deleteById(id);
    }
}
